const WebpackAliyunOssPlugin = require('webpack-aliyun-oss-plugin')

const bucket = process.env.ALIOSS_BUCKET

let aliOssPlugin = null

if (bucket && process.argv[2] === 'build') {
  aliOssPlugin = new WebpackAliyunOssPlugin({
    bucket,
    // account: 'ossuer',
    region: 'oss-cn-shenzhen', // bucket所在区域的接入点
    filter(asset) {
      return !/\.html$/.test(asset)
    },
  })
}

module.exports = {
  aliOssPlugin,
}
